package com.cn.serverline.lineicp.workshopPlan.util;

import java.sql.Date;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author eomer
 * @title DateUtil
 * @date 2023/12/11
 * @description 日期处理类
 */
public class DateUtil {

    public static Timestamp getTimestamp() {
        return new Timestamp(System.currentTimeMillis());
    }

    public static void main(String[] args) {
        String s = "30";
        int minutesToAdd = Integer.parseInt(s);

        // 获取指定时间
        LocalDateTime now = LocalDateTime.parse("2024-08-20T15:15:34");

        // 加上指定的分钟数
        LocalDateTime newTime = now.plusMinutes(minutesToAdd);

        // 格式化时间输出
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String formattedTime = newTime.format(formatter);

        System.out.println("指定时间加上 " + s + " 分钟后的时间是: " + formattedTime);
    }

}
